package top.malaoshi.webmvc.parameter;

import top.malaoshi.webmvc.info.MethodsArgumentInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 对 ExceptionHandle 注解修饰方法进行解析形参
 */
public class ExceptionHandlerResolver implements RequestParamAndMethodArgsResolver {
    public static final String REQUEST_EXCEPTION = "top.malaoshi.sprout.ExceptionHandler.exception";
    @Override
    public Object resolver(HttpServletRequest request, HttpServletResponse response , MethodsArgumentInfo mai) {
        Throwable t = (Throwable) request.getAttribute(REQUEST_EXCEPTION);
        return t;
    }
}
